package com.example.homeworkmutualevaluation.Service;

import com.example.homeworkmutualevaluation.Dao.BulletinDao;
import com.example.homeworkmutualevaluation.Entity.Bulletin;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BulletinService {
    @Resource
    private BulletinDao bulletinDao;
    public int insert(String adminid, String title, String content) {
        Bulletin bulletin = new Bulletin(adminid, title, content);
        bulletinDao.save(bulletin);
        return bulletin.getId();
    }
    public boolean update(int id, String title, String content) {
        return bulletinDao.update(id, title, content) > 0;
    }
    public boolean delete(int id) {
        return bulletinDao.delete(id) > 0;
    }
    public List<Bulletin> findAll() {
        return bulletinDao.selectAll();
    }
}
